package dao;

import bean.Administrator;

import java.sql.ResultSet;
import java.sql.SQLException;
public class Administratordao extends Basedao {
    public Administrator login(String account, String password) {
        String sql = "select * from  administrator where account = '" + account + "' and password = '" + password + "'";
        ResultSet resultSet = query(sql);
        try {
            if (resultSet.next()) {
                Administrator administrator = new Administrator();
                administrator.setaccount(resultSet.getString("account"));
                administrator.setPassword(resultSet.getString("password"));
                return administrator;
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}